package com.leyou.item.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @create: 2019-07-13 19:36
 **/
@RequestMapping("spec")
public interface SpecificationApi {

    /**
     * 根据条件查询规格参数
     *
     * @param gid       分组id
     * @param cid       分类id
     * @param generic   是否是sku通用属性
     * @param searching 是否用于搜索过滤
     * @return
     */
    @GetMapping("params")
    List<SpecParam> queryParam(
            @RequestParam(value = "gid", required = false) Long gid,
            @RequestParam(value = "cid", required = false) Long cid,
            @RequestParam(value = "generic", required = false) Boolean generic,
            @RequestParam(value = "searching", required = false) Boolean searching
    );

    /**
     * 根据分类id查询规格组，及组下的所有规模参数
     *
     * @param cid
     * @return
     */
    @GetMapping("/group/param/{cid}")
    List<SpecGroup> queryGroupWithParam(@PathVariable("cid") Long cid);
}
